<?
$map = $this->map;
$answers = $this->answers;
?>
<div style="margin: 0 auto">
<!--    <div class="title_map">--><?//= $map['title'] ?><!--</div>-->
    <img class="img_map" src="<?=$map['url']?>"/>
<table class="main_table">
    <thead>
    <tr>
        <td colspan="2">
           <?=$map['description']?>
        </td>
    </tr>
    </thead>
    <tbody>
    <tr class="next">
        <td>Date Start</td>
        <td><?=$map['datestart']->format('Y-m-d')?></td>
    </tr>
    <tr>
        <td>Date Stop</td>
        <td><?=$map['dateend']->format('Y-m-d')?></td>
    </tr>
    <tr class="next">
        <td>Treasure</td>
        <td><?=$map['price']?> piastres</td>
    </tr>
    <tr>
        <td>Answer</td>
        <td><?= $map['answer'] ?></td>
    </tr>
    </tbody>
</table>
    <div style="clear: both;"></div>
</div>
<script>
    $(function(){


          $('.defaulttable:eq(1) thead td:nth-child(1)').css('width','25px')
          $('.defaulttable:eq(1) thead td:nth-child(2)').css('width','150px');
          $('.defaulttable:eq(1) thead td:nth-child(3)').css('width','120px');
          $('.defaulttable:eq(1) thead td:nth-child(4)').css('width','100px');
 



            $('.defaulttable tbody tr:odd').addClass('odd');

    });
</script>

<div>
    <? if (count($answers) > 0): ?>


    <table class="main_table">
        <thead>
        <tr>
            <td >#</td>
            <td >User's nickname</td>
            <td >Date</td>
            <td>Is correct</td>
        </tr>
        </thead>
<!--<a href="/user/view/id/--><?//= $answer['user']['id'] ?><!--">--><?//= $answer['user']['nick'] ?><!--</a>-->
        <tbody>

            <? foreach ($answers as $key => $answer): ?>
          
            <? $winnerStyle = $answer['winner'] ? 'style="background-color: grey;"' : null ?>

        <tr <?= $winnerStyle ?> class="next">
            <td><?= $key + 1 ?></td>
            <td><a href="user/view/id/<?=$answer['user']['id']?>"><img src="<?=$answer['user']['avatar']?>" alt=""><br>
                <?= ($answer['user']['nick'])?></a></td>
            <td><?= $answer['time']->format('Y-m-d') ?></td>
            <td>
                <?= $correct = $answer['isCorrect'] ? 'yes' : 'no' ?>
            </td>

        </tr>
        
            <? endforeach;?>
        </tbody>
    </table>

    <? else: ?>
    No participents.
    <? endif;?>
</div>